package com.fenghongzhang.day007;

import androidx.appcompat.app.AppCompatActivity;

import android.graphics.Color;
import android.os.Bundle;
import android.view.Gravity;
import android.view.View;
import android.widget.Button;
import android.widget.Toast;

import com.ashokvarma.bottomnavigation.BottomNavigationBar;
import com.ashokvarma.bottomnavigation.BottomNavigationItem;
import com.ashokvarma.bottomnavigation.ShapeBadgeItem;
import com.ashokvarma.bottomnavigation.TextBadgeItem;

public class MainActivity extends AppCompatActivity implements BottomNavigationBar.OnTabSelectedListener {

    private MyView myView;
    private BottomNavigationBar btn;

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_main);

        myView = (MyView) findViewById(R.id.myView);

        btn = (BottomNavigationBar) findViewById(R.id.btn);
        btn.setTabSelectedListener(this)
                .setBackgroundStyle(BottomNavigationBar.BACKGROUND_STYLE_STATIC)
                .setMode(BottomNavigationBar.MODE_FIXED)
                .setActiveColor("#ff0000")
                .setInActiveColor("#999999")
                .setBarBackgroundColor("#000000");

        TextBadgeItem textBadgeItem = new TextBadgeItem();
        textBadgeItem.setText("99").setTextColor(Color.GREEN).setBorderColor(Color.GREEN).setBorderWidth(5).setHideOnSelect(true);


        btn.addItem(new BottomNavigationItem(R.drawable.rcd_icn_love,"首页").setInActiveColor(Color.BLUE))
                .addItem(new BottomNavigationItem(R.mipmap.ic_launcher,"主题").setBadgeItem(textBadgeItem))
                .addItem(new BottomNavigationItem(R.mipmap.ic_launcher,"活动"))
                .initialise();


//        btn.addItem(new BottomNavigationItem(R.mipmap.ic_launcher,"标题"));
//        btn.addItem(new BottomNavigationItem(R.mipmap.ic_launcher,"主题"));
//        btn.addItem(new BottomNavigationItem(R.mipmap.ic_launcher,"活动"));
//

    }

    public void add(View view) {
        myView.addImageView();
    }

    @Override
    public void onTabSelected(int position) {
        Toast.makeText(this, ""+position, Toast.LENGTH_SHORT).show();
    }

    @Override
    public void onTabUnselected(int position) {
        Toast.makeText(this, "bb"+position, Toast.LENGTH_SHORT).show();
    }

    @Override
    public void onTabReselected(int position) {
        Toast.makeText(this, "aa"+position, Toast.LENGTH_SHORT).show();
    }
}
